package com.lww.feature.test.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * User: yian
 * Date: 2017/5/19
 */
public class ProxyHandler implements InvocationHandler {

    private Subject subject;

    public ProxyHandler(Subject subject) {
        this.subject = subject;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("===========before===========");
        Object result = method.invoke(subject, args);
        System.out.println("===========after===========");
        return result;
    }
}
